import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { DictionaryType } from "./dictionary_type.entity";

@Entity()
export class DictionaryData {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    comment:"字典标签"
  })
  label: string;

  @Column({
    comment: "字典键值",
    type: "int",
    default: 1
  })
  value: number

  @Column({
    comment:"颜色",
  })
  color: string

  @Column({
    comment:"rgb色值",
    type: 'simple-json',
  })
    rgb: number[]

  @Column({
    comment:"排序",
    type:"int",
    default:0
  })
  sort: number

  @ManyToOne(()=> DictionaryType, (type)=> type.dictionaryData)
  dictionaryType: DictionaryType;

  @CreateDateColumn()
  createTime: Date;
}